package com.sanjiahantang.youjiarole.module.common.presenters;

import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import android.view.View;

import com.sanjiahantang.uilibrary.utils.Utils;
import com.sanjiahantang.youjiarole.R;
import com.sanjiahantang.youjiarole.base.BaseMvpActivity;
import com.sanjiahantang.youjiarole.base.BaseMvpPresenter;
import com.sanjiahantang.youjiarole.config.ConfigValue;
import com.sanjiahantang.youjiarole.config.SPConfig;
import com.sanjiahantang.youjiarole.module.common.views.SettingsView;
import com.sanjiahantang.youjiarole.module.common.views.impl.MyMaterialMangerActivity;
import com.sanjiahantang.youjiarole.module.common.views.impl.SettingsActivity;
import com.sanjiahantang.youjiarole.module.login.views.impl.ChangePasswordActivity;
import com.sanjiahantang.youjiarole.module.login.views.impl.LoginActivity;
import com.sanjiahantang.youjiarole.module.me.account.views.impl.AccountActivity;
import com.sanjiahantang.youjiarole.module.me.address.views.impl.AddressListActivity;
import com.sanjiahantang.youjiarole.utils.SPUtils;

import java.util.HashSet;
import java.util.Set;

import cn.jpush.android.api.JPushInterface;


/**
 * Created by zy on 2017/9/4.
 */

public class SettingsPresenter extends BaseMvpPresenter<SettingsView> {
    public void goMyInfo(BaseMvpActivity context) {
        goPageSimply(context, AccountActivity.class);
    }

    public void goChangePSD(BaseMvpActivity context) {
        ChangePasswordActivity.changeLoginPsd(context);
    }
    public void goWuLiaoManager(BaseMvpActivity context) {
        goPageSimply(context, MyMaterialMangerActivity.class);
    }
    public void goAddressManage(BaseMvpActivity context) {
        goPageSimply(context, AddressListActivity.class);
    }

    public void logout(final Activity activity) {
        if (!TextUtils.isEmpty(ConfigValue.DATA_KEY)) {
            Utils.showDialog(activity, "提示", "确定退出登录吗？", "", "", new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Utils.dismissDialog();
                    switch (view.getId()) {
                        case R.id.txtDialogCancel:
                            break;
                        case R.id.txtDialogSure:
                            //解绑tag
                            LoginActivity.logout(activity);
                            activity.finish();
                            break;
                    }
                }
            });
        }
    }

    public void goChangePayPSD(Context context) {
        ChangePasswordActivity.changePayPsd(context);
    }
}
